473,435 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,435 software developers and data experts.

jQuery show hide needs speed added for slideUp

This function swaps images between a close & replay GIF. Line 12 has a speed of 1 second specified for the slideDown, but no speed specified for the slideUp so it is defaulting to normal. I tried adding if(!isDown) slideTimeout = setTimeout(toggleSlideboxes, 3000 : 1000); to line 21 but ended up with a syntax error.

Expand|Select|Wrap|Line Numbers
  1. jQuery.noConflict();
  2. jQuery(document).ready(function(){
  3.   var slideTimeout //timer
  4.      , sbTrigger = jQuery('#slidebartrigger') //convenience
  5.  
  6.      , sbFirstSlide = (document.cookie.indexOf('slidedToday') == -1) //check cookie for 'already seen today'
  7.      ;
  8.   function toggleSlideboxes(){
  9.     if(slideTimeout) clearTimeout(slideTimeout);
  10.     var isDown = sbTrigger.is('.closeSlide');
  11.  
  12.     jQuery('#slidebar')['slide' + (isDown ? 'Up' : 'Down')]((isDown ? 3000 : 1000), function(){
  13.  
  14.         if(sbFirstSlide){ //if 'first time today' then clear for click-to-replay
  15.           sbTrigger.removeClass('firstSlide');
  16.           sbFirstSlide = false;
  17.         }
  18.  
  19.         sbTrigger[(isDown ? 'remove' : 'add') + 'Class']('closeSlide').one('click', toggleSlideboxes);
  20.  
  21.         if(!isDown) slideTimeout = setTimeout(toggleSlideboxes, 3000);
  22.  
  23.       });
  24.  
  25.   }
  26.  
  27.  
this is the relevant CSS

Expand|Select|Wrap|Line Numbers
  1.  #slidebartrigger {
  2.  position:relative;
  3.  background:  url(http://cincinnati.com/test/img/replayBlack.gif) no-repeat right top;
  4.  display: block;
  5.  padding: 0;
  6.  height: 13px;
  7.  width:53px;
  8.  float:right;
  9.  margin-top:-14px;
  10.  z-index:2;
  11. }
  12. #slidebartrigger.closeSlide {
  13.  background:  url(http://cincinnati.com/test/img/closeBlack.gif) no-repeat right top;
  14.  display: block;
  15.  padding: 0px;
  16.  height: -14px;
  17. }
  18. /* this is purely so that replay.jpg isn't showing during during the initial slideDown...*/
  19. #slidebartrigger.firstSlide {
  20.  background: url("http://cincinnati.com/test/img/blank.gif") no-repeat right top;
  21.  display: block;
  22.  padding: 0px;
  23.  height: 14px;
  24. }  
Jul 1 '08 #1
1 2298
acoder
16,027 Expert Mod 8TB
The ?: notation is short for if/else, so you would need something like:
Expand|Select|Wrap|Line Numbers
  1. slideTimeout = setTimeout(toggleSlideboxes, (isDown ? 3000 : 1000));
Jul 1 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: libsfan01 | last post by:
hi i have a page which contains an visible nav down the left-hand side. when you click a button it needs to appear. i thought it would be cool to use scriptaculous to make it slide down. can...
7
by: nolo contendere | last post by:
the alert message appears before the Effect.SlideUp even begins. How can I ensure that the SlideUp completes before executing the next statement? I've tried setTimeout, and I can kind of get it to...
83
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about...
3
by: NetWave | last post by:
Hi, For my next project I'm going to need Ajax, so I'm in about to read some books on ASP.NET Ajax. While reading Rick Strahl's blog I stumbled upon jQuery. I've been to the website and seen...
26
by: RobG | last post by:
Do some of the regulars here need to re-think their (sometimes strident) opposition to libraries? Both Microsoft and Nokia have announced support for jQuery. It seems to have gained quite a bit...
2
by: souporpower | last post by:
Hi All I am trying to print some HTML using JQUERY. I am posting the code. I don't see the alert. It seems as though the function is not registered when the document is loaded. Can someone...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
3
omerbutt
by: omerbutt | last post by:
hi there i am trying to run the lightbox and a slider on a single page the light box is working allrigh but when i try to include the slider in the same page it generates error because i have to...
3
by: jmeyer5csc | last post by:
i am using jquery to display a working... div to show the user that the query is doing something. to show.... Sys.Application.add_init(function() { ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.